<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon.ico?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Linux云服务器,">










<meta name="description" content="CentOS下安装MongoDB1.下载安装 MongoDB1wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.13.tgz 2. 创建文件夹和解压文件 cd 到 usr 目录 1cd /usr  新建mongodb目录 1mkdir -m 777 mongodb  解压到usr/mongodb 目录下 1tar zxvf">
<meta name="keywords" content="Linux云服务器">
<meta property="og:type" content="article">
<meta property="og:title" content="centos下安装MongoDB">
<meta property="og:url" content="http://zhanglei_c.gitee.io/blog/2020/03/26/centos下安装MongoDB/index.html">
<meta property="og:site_name" content="爱吃零食的猫">
<meta property="og:description" content="CentOS下安装MongoDB1.下载安装 MongoDB1wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.13.tgz 2. 创建文件夹和解压文件 cd 到 usr 目录 1cd /usr  新建mongodb目录 1mkdir -m 777 mongodb  解压到usr/mongodb 目录下 1tar zxvf">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2020-03-26T15:09:55.121Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="centos下安装MongoDB">
<meta name="twitter:description" content="CentOS下安装MongoDB1.下载安装 MongoDB1wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.13.tgz 2. 创建文件夹和解压文件 cd 到 usr 目录 1cd /usr  新建mongodb目录 1mkdir -m 777 mongodb  解压到usr/mongodb 目录下 1tar zxvf">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://zhanglei_c.gitee.io/blog/2020/03/26/centos下安装MongoDB/">





  <title>centos下安装MongoDB | 爱吃零食的猫</title>
  








</head>

<script type="text/javascript" color="0,0,255" opacity="0.7" zindex="-2" count="99" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
<a href="https://github.com/403NotFound" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewbox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">爱吃零食的猫</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">自由，平等，公正，法治</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://zhanglei_c.gitee.io/blog/blog/2020/03/26/centos下安装MongoDB/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Zhang_lei">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="爱吃零食的猫">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">centos下安装MongoDB</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-03-26T20:46:16+08:00">
                2020-03-26
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="CentOS下安装MongoDB"><a href="#CentOS下安装MongoDB" class="headerlink" title="CentOS下安装MongoDB"></a>CentOS下安装MongoDB</h2><h3 id="1-下载安装-MongoDB"><a href="#1-下载安装-MongoDB" class="headerlink" title="1.下载安装 MongoDB"></a>1.下载安装 <code>MongoDB</code></h3><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-<span class="number">3.6</span>.<span class="number">13</span>.tgz</span><br></pre></td></tr></table></figure>
<h3 id="2-创建文件夹和解压文件"><a href="#2-创建文件夹和解压文件" class="headerlink" title="2. 创建文件夹和解压文件"></a>2. 创建文件夹和解压文件</h3><ul>
<li><p>cd 到 usr 目录</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd /usr</span><br></pre></td></tr></table></figure>
</li>
<li><p>新建mongodb目录</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -m <span class="number">777</span> mongodb</span><br></pre></td></tr></table></figure>
</li>
<li><p>解压到usr/mongodb 目录下</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar zxvf mongodb-linux-x86_64-rhel70-<span class="number">3.6</span>.<span class="number">13</span>.tgz</span><br></pre></td></tr></table></figure>
</li>
<li><p>重命名文件夹</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mv mongodb-linux-x86_64-rhel70-<span class="number">3.6</span>.<span class="number">13</span> mongodb-<span class="number">3.6</span>.<span class="number">13</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="3-配置环境变量和初始化操作"><a href="#3-配置环境变量和初始化操作" class="headerlink" title="3.配置环境变量和初始化操作"></a>3.配置环境变量和初始化操作</h3><ul>
<li><p>配置环境变量</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/profile</span><br></pre></td></tr></table></figure>
<p>在 <code>export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL</code>上面一行添加<code>export PATH=/usr/mongodb/mongodb-4.0.10/bin:$PATH</code></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">export PATH=/usr/mongodb/mongodb-<span class="number">3.6</span>.<span class="number">13</span>/bin:<span class="variable">$PATH</span></span><br><span class="line">export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL</span><br></pre></td></tr></table></figure>
</li>
<li><p>使环境变量生效</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">source /etc/profile</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建<code>mongodb.conf</code>配置文件</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd /usr/mongodb/mongodb-<span class="number">3.6</span>.<span class="number">13</span></span><br><span class="line">touch mongodb.conf</span><br></pre></td></tr></table></figure>
</li>
<li><p>在该目录下创建数据库目录，日志目录</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mkdir db</span><br><span class="line">mkdir log</span><br></pre></td></tr></table></figure>
</li>
<li><p>设置文件夹权限，方便操作</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chmod <span class="number">777</span> db</span><br><span class="line">chmod <span class="number">777</span> log</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建日志 文件</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd log</span><br><span class="line">touch mongodb.log</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="4-修改配置文件内容"><a href="#4-修改配置文件内容" class="headerlink" title="4.修改配置文件内容"></a>4.修改配置文件内容</h3><ul>
<li><p>添加mongodb.conf配置文件</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#端口</span></span><br><span class="line">port=<span class="number">27017</span></span><br><span class="line"><span class="comment">#数据库存文件存放目录</span></span><br><span class="line">dbpath= /usr/mongodb/mongodb-<span class="number">4.0</span>.<span class="number">10</span>/db</span><br><span class="line"><span class="comment">#日志文件存放路径</span></span><br><span class="line">logpath= /usr/mongodb/mongodb-<span class="number">4.0</span>.<span class="number">10</span>/log/mongodb.log </span><br><span class="line"><span class="comment">#使用追加的方式写日志</span></span><br><span class="line">logappend=true</span><br><span class="line"><span class="comment">#以守护进程的方式运行，创建服务器进程</span></span><br><span class="line">fork=true </span><br><span class="line"><span class="comment">#最大同时连接数</span></span><br><span class="line">maxConns=<span class="number">100</span></span><br><span class="line"><span class="comment">#不启用验证</span></span><br><span class="line">noauth=true</span><br><span class="line"><span class="comment">#每次写入会记录一条操作日志（通过journal可以重新构造出写入的数据）。</span></span><br><span class="line">journal=true </span><br><span class="line"><span class="comment">#即使宕机，启动时wiredtiger会先将数据恢复到最近一次的checkpoint点，然后重放后续的journal日志来恢复。</span></span><br><span class="line"><span class="comment">#存储引擎，有mmapv1、wiretiger、mongorocks</span></span><br><span class="line">storageEngine=wiredTiger</span><br><span class="line"><span class="comment">#设置成全部ip可以访问，这样就可以在windows中去连虚拟机的MongoDB，也可以设置成某个网段或者某个ip</span></span><br><span class="line">bind_ip = <span class="number">0.0</span>.<span class="number">0.0</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="5-启动mongodb"><a href="#5-启动mongodb" class="headerlink" title="5.启动mongodb"></a>5.启动mongodb</h3><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mongod --config /usr/mongodb/mongodb-<span class="number">3.6</span>.<span class="number">13</span>/mongodb.conf</span><br></pre></td></tr></table></figure>
<blockquote>
<p><strong>可能出现的问题:</strong></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&gt; [root@VM_0_14_centos mongodb-<span class="number">3.6</span>.<span class="number">13</span>]<span class="comment"># mongod --config /usr/mongodb/mongodb-3.6.13/mongodb.conf </span></span><br><span class="line">&gt; about to fork child <span class="keyword">process</span>, waiting <span class="keyword">until</span> server is ready <span class="keyword">for</span> connections.</span><br><span class="line">&gt; forked <span class="keyword">process</span>: <span class="number">18899</span></span><br><span class="line">&gt; ERROR: child <span class="keyword">process</span> failed, exited with error number <span class="number">48</span></span><br><span class="line">&gt; To see additional information <span class="keyword">in</span> this output, start without the <span class="string">"--fork"</span> option.</span><br><span class="line">&gt;</span><br></pre></td></tr></table></figure>
</blockquote>
<blockquote>
<p><strong>原因是可能27017端口被占用！！</strong></p>
<p><code>解决方案：</code>先使用netstat -ntlp 查看mongo.conf配置文件里对应的 port=27017， 然后使用kill -9 14540 【PID进程号】 杀死此进程 最后在到bin目录下再次执行</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">&gt; [root@VM_0_14_centos mongodb-<span class="number">3.6</span>.<span class="number">13</span>]<span class="comment"># netstat -ntlp</span></span><br><span class="line">&gt; Active Internet connections (only servers)</span><br><span class="line">&gt; Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    </span><br><span class="line">&gt; tcp        <span class="number">0</span>      <span class="number">0</span> <span class="number">127.0</span>.<span class="number">0.1</span>:<span class="number">27017</span>         <span class="number">0.0</span>.<span class="number">0.0</span>:*               LISTEN      <span class="number">1250</span>/mongod         </span><br><span class="line">&gt; tcp        <span class="number">0</span>      <span class="number">0</span> <span class="number">0.0</span>.<span class="number">0.0</span>:<span class="number">22</span>              <span class="number">0.0</span>.<span class="number">0.0</span>:*               LISTEN      <span class="number">1367</span>/sshd           </span><br><span class="line">&gt; tcp6       <span class="number">0</span>      <span class="number">0</span> :::<span class="number">80</span>                   :::*                    LISTEN      <span class="number">30780</span>/node /home/ad </span><br><span class="line">&gt; tcp6       <span class="number">0</span>      <span class="number">0</span> :::<span class="number">21</span>                   :::*                    LISTEN      <span class="number">10355</span>/vsftpd        </span><br><span class="line">&gt; [root@VM_0_14_centos mongodb-<span class="number">3.6</span>.<span class="number">13</span>]<span class="comment"># kill -9 1250</span></span><br><span class="line">&gt; [root@VM_0_14_centos mongodb-<span class="number">3.6</span>.<span class="number">13</span>]<span class="comment"># mongod --config /usr/mongodb/mongodb-3.6.13/mongodb.conf </span></span><br><span class="line">&gt; about to fork child <span class="keyword">process</span>, waiting <span class="keyword">until</span> server is ready <span class="keyword">for</span> connections.</span><br><span class="line">&gt; forked <span class="keyword">process</span>: <span class="number">19812</span></span><br><span class="line">&gt; child <span class="keyword">process</span> started successfully, parent exiting</span><br><span class="line">&gt;</span><br></pre></td></tr></table></figure>
</blockquote>
<blockquote>
<p>出现上述信息则代表配置文件成功配置，数据库成功打开!</p>
</blockquote>
<h3 id="6-关闭防火墙"><a href="#6-关闭防火墙" class="headerlink" title="6.关闭防火墙"></a>6.关闭防火墙</h3><ul>
<li><p>关闭防火墙</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl stop firewalld.service         <span class="comment">#停止firewall</span></span><br><span class="line">systemctl disable firewalld.service    <span class="comment">#禁止firewall开机启动</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="7-开心的连接数据库啦！"><a href="#7-开心的连接数据库啦！" class="headerlink" title="7. 开心的连接数据库啦！"></a>7. 开心的连接数据库啦！</h3><p>在浏览器中使用 <code>公网ip/域名：27017</code>如果看到如下的信息则代表成功开启mongodb数据库！</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">It looks like you are trying to access MongoDB over HTTP on the native driver port.</span><br></pre></td></tr></table></figure>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/Linux云服务器/" rel="tag"># Linux云服务器</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2020/01/16/react入门/" rel="next" title="react入门">
                <i class="fa fa-chevron-left"></i> react入门
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2020/04/09/linux批量查找并删除文件/" rel="prev" title="linux批量查找并删除文件">
                linux批量查找并删除文件 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Zhang_lei</p>
              <p class="site-description motion-element" itemprop="description">爱吃零食的猫</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">43</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/blog/tags/index.html">
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/403NotFound" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.zhihu.com/people/ai-chi-bao-mi-hua-de-mao/activities" target="_blank" title="知乎">
                      
                        <i class="fa fa-fw fa-send"></i>知乎</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://gitee.com/ZhangLei_c" target="_blank" title="码云">
                      
                        <i class="fa fa-fw fa-github-alt"></i>码云</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://weibo.com/5205419998/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1" target="_blank" title="weibo">
                      
                        <i class="fa fa-fw fa-weibo"></i>weibo</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#CentOS下安装MongoDB"><span class="nav-number">1.</span> <span class="nav-text">CentOS下安装MongoDB</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-下载安装-MongoDB"><span class="nav-number">1.1.</span> <span class="nav-text">1.下载安装 MongoDB</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-创建文件夹和解压文件"><span class="nav-number">1.2.</span> <span class="nav-text">2. 创建文件夹和解压文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-配置环境变量和初始化操作"><span class="nav-number">1.3.</span> <span class="nav-text">3.配置环境变量和初始化操作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-修改配置文件内容"><span class="nav-number">1.4.</span> <span class="nav-text">4.修改配置文件内容</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-启动mongodb"><span class="nav-number">1.5.</span> <span class="nav-text">5.启动mongodb</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-关闭防火墙"><span class="nav-number">1.6.</span> <span class="nav-text">6.关闭防火墙</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#7-开心的连接数据库啦！"><span class="nav-number">1.7.</span> <span class="nav-text">7. 开心的连接数据库啦！</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Zhang_lei</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>


<div>
<span id="busuanzi_container_site_pv">
  本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>
<span id="busuanzi_container_site_uv">
    有<span id="busuanzi_value_site_uv"></span>人看过我的博客啦
</span>
</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
